package easy

func LongestPalindrome(s string) int {
	count := [128]int{}
	n := len(s)
	for i := 0; i < n; i++ {
		ch := s[i]
		count[ch]++
	}
	ans := 0
	for _, val := range count {
		ans += val / 2 * 2
		if ans%2 == 0 && val%2 == 1 {
			ans++
		}
	}
	return ans
}
